package com.cskaoyan.weixin.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.storage.Storage;
import com.cskaoyan.service.ObjectStorageService;
import com.cskaoyan.weixin.service.WxStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/wx/storage")
public class WxStorageController {

    @Autowired
    ObjectStorageService objectStorageService;

    @RequestMapping("upload")
    public BaseRespVo upload(MultipartFile file) {
        Storage storage = objectStorageService.create(file);
        return BaseRespVo.ok(storage);
    }
}
